#include "condition.hpp"
#include <iostream>

namespace rocket 
{
condition::condition(pthread_mutex_t *lock)
:_lock(lock)
{
    pthread_cond_init(&_condition, NULL);
}
condition::~condition()
{
    pthread_cond_destroy(&_condition);
}

void condition::wait()
{
    pthread_cond_wait(&_condition, _lock);
}
void condition::notify_one()
{
    pthread_cond_signal(&_condition);
}
void condition::notify_all()
{
    pthread_cond_broadcast(&_condition);
}

}